package com.chis.client;

import com.alibaba.fastjson.JSONObject;

import java.util.Map;


public class BuildParam {

    public static void createSign(String appId, String appKey, Map<String, Object> reqMap, String data)throws Exception {
        reqMap.put( "app_id", appId);
        reqMap.put( "process_id", UuidUtil.uuid());
        reqMap.put( "sign_type", "MD5");
        reqMap.put( "timestamp", DateUtil.createTimeStamp( DateUtil.DATE_FORMATE_0));
        reqMap.put( "ver", "1.0");
        reqMap.put( "event", data);
        String sign;
        try{
            sign= CheckSignUtil.signToRequest( reqMap, appKey, (String)reqMap.get( "sign_type"));
        }catch ( Exception e){
            throw new Exception( "签名失败", e);
        }
        reqMap.put( "event", JSONObject.parseObject( data));
        reqMap.put( "sign", sign);
    }
}
